package me.leiusual.sharing.repository

import io.reactivex.Single
import me.leiusual.sharing.api.ApiSharing
import me.leiusual.sharing.api.model.cartdetail.CartList
import javax.inject.Inject
import javax.inject.Singleton

/**
 * author: leiusual
 * create on: 2019-07-27
 * description:
 */
@Singleton
class CartRepository @Inject constructor(
    private val apiSharing: ApiSharing
) {

  fun cartAdd(mia: Long, quantity: Int, r: Long?): Single<Unit> {
    return apiSharing.cartAdd(mia, quantity, r)
  }

  fun cartChange(shopCartId: Long, quantity: Int): Single<Unit> {
    return apiSharing.cartChange(shopCartId, quantity)
  }

  fun cartList(): Single<CartList> {
    return apiSharing.cartList()
  }

  fun cartRemove(shopCartId: Long): Single<Unit> {
    return apiSharing.cartRemove(shopCartId)
  }
}